<?php
declare(strict_types=1);
echo PHP_VERSION;
echo PHP_EOL;

//构造器属性提升
/**1.属性声明和初始化合二为一----------------------------------------------------------------------------------------------------*/
//class Person
//{
//    public function __construct(public $name)
//    {
//        echo $this->name;
//    }
//}
//$obj = new Person('zs');


/**2.混合使用提升----------------------------------------------------------------------------------------------------*/
class Cat{
    public function __construct(public string $name='猫', $tail='尾巴')
    {
        echo $this->name.$tail;
    }
}
$obl = new Cat();

/**3.混合使用提升----------------------------------------------------------------------------------------------------*/
//抽象类里的抽象构造函数，构造器属性提升不适用
abstract class Animal{
   //abstract public function name();
    abstract public function __construct(string $name);
    abstract public function say(string $name);
}

class People extends Animal
{
    public function __construct(string $name)
    {

    }
    public function say($name)
    {
        echo '人类';
    }
}
//$p = (new People('zs'))->say('a');